<%@ taglib uri="/struts-tags" prefix="s" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/transition/transition.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/transition/demo.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/Implementation/implementation.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath}/Js/Usuario/adminUsers.js"></script>

        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/estilo.css" />
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/stylSergio.css" />

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Users</title>
    </head>
    
    <body>
        <s:div cssClass="divBlancoMenor"></s:div>
        <s:div cssClass="contenidoAzul">
            <jsp:include page="/jsp/encabezado.jsp" flush="true" />
            <jsp:include page="/jsp/menu.jsp" flush="true" />
            <s:div cssClass="divBlanco"></s:div>
        </s:div> 

        <s:div cssClass="contenidoBlancoEdit">
            <fieldset>                                   
                <legend>
                    Users
                </legend>  
                <br/>
                <br/>
                <s:form action="Usuarios" >
                    <s:textfield id="txtSearch" maxLength="20" name="username" cssClass="textField" label="User"></s:textfield>
                        &nbsp;&nbsp; 
                        <button type="button" id="btnBuscar" class="loginBoton" onclick="search();">Search</button>
                    <s:submit id="botonBuscar" key="usuario.boton.buscar.prop" cssClass="escondido" 
                              name="buttonAction" cssStyle="display: none;" method="GetUsersByName" />
                    <br/>
                    <table  rules="all" class="listado">
                        <thead>
                            <tr>         
                                <th style="width: 15px">
                                    ID
                                </th>
                                <th style="width: 20px">
                                    User
                                </th>
                                <th style="width: 20px">
                                    Password
                                </th>

                                <th style="width: 25px">
                                    Mail
                                </th>
                                <th style="width: 15px" >
                                    Action
                                </th>
                                <th style="width: 15px" >
                                    Action
                                </th>
                            </tr>
                        </thead>                              
                        <tbody>
                            <s:iterator value="users" >
                                <tr>
                                    <td align="center"><s:property value="id" /></td>

                                    <td align="center"><s:property value="username" /></td>

                                    <td align="center"><s:property value="pwd" /></td>

                                    <td align="center"><s:property value="email" /></td>

                                    <td align="center">
                                        <s:a id="%{id}" cssClass="buttonTablaDepartamento" 
                                            onclick="return muestraPopupNewUsuarios(this.id);">Modify 
                                            <s:param name="idUserSelected" value="id"></s:param>
                                        </s:a>
                                    </td> 
                                    <td align="center">
                                        <s:a  id="%{id}" cssClass="buttonTablaDepartamento" 
                                            method="DeleteUserClient" >Delete
                                            <s:param name="idUserSelected" value="id"></s:param>
                                        </s:a>
                                    </td> 
                                </tr>  
                            </s:iterator>
                        </tbody>                  
                    </table> 
                    <script>
                        usersSpring = "";
                        var usersSpringTEM  = new Array();
                        <s:iterator value="usersSpring" >
                            usersSpringTEM= "" + "<s:property value='toString()' />";
                        </s:iterator>
                            usersSpring= usersSpringTEM.split("~");
                            function search(){
                                $("#botonBuscar").click();
                            }
                    </script>
                </fieldset>
            </s:form>
        </s:div>
        <div id="ventanaPopup1Usuarios">
            <a id="ventanaPopup1CerrarUsuarios">Close</a>

            <h1 align="center">Modify User</h1>

            <s:form action="Usuarios" cssClass="continuos_div_form" >

                <s:textfield cssClass="oculto" id="idUserOculto" name="userDataModificar.id" ></s:textfield>

                <s:textfield label="User" id="idPopTxtNombre"  maxLength="20" name="username" cssClass="textField" />
                <s:password label="Password" id="idPopPaswoord" maxLength="20" name="pwd" cssClass="textField insertar" />
                <s:textfield label="Mail" id="idPopCorreo" maxLength="30"  name="email" cssClass="textField insertar" />
                
                <table border="0">
                    <tr>
                        <td style="text-align: left">
                            <fieldset class="fieldSetSmall" id="fsTran">
                                <s:if test="username == 'Rubi'">
                                    
                                </s:if>
                                <legend>Transition</legend>
                                <input type="radio" name="Tran" value="RO" id="tranRO" >
                                <label>Read Only</label></br></br>
                                <input type="radio" name="Tran" value="E" id="tranE">
                                <label>Edit</label></br></br>
                                <input type="radio" name="Tran" value="NA" id="tranNA">
                                <label>No Access</label></br>
                            </fieldset>
                        </td>
                        <td style="text-align: left">
                            <fieldset class="fieldSetSmall" id="fsImp">
                                <legend>Implementation</legend>
                                <input type="radio" name="Imp" value="RO" id="impRO">
                                <label>Read Only</label></br></br>
                                <input type="radio" name="Imp" value="E" id="impE">
                                <label>Edit</label></br></br>
                                <input type="radio" name="Imp" value="NA" id="impNA">
                                <label>No Access</label></br>
                            </fieldset>
                        </td>
                        <td align="right">
                            <fieldset class="fieldSetSmall" style="text-align: left" id="fsCop">
                                <legend>COP</legend>
                                <input type="radio" name="Cop" value="RO" id="copRO">
                                <label>Read Only</label></br></br>
                                <input type="radio" name="Cop" value="E" id="copE">
                                <label>Edit</label></br></br>
                                <input type="radio" name="Cop" value="NA" id="copNA">
                                <label>No Access</label></br>
                            </fieldset>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: left">
                            <fieldset class="fieldSetSmall" id="fsSu">
                                <legend>Super User</legend>
                                </br>
                                <s:checkbox name="SUA" theme="simple" id="SU"/>
                                <s:label value="All" theme="simple"/>
                            </fieldset>
                        </td>
                    </tr>
                </table>  
                <s:submit id="submitValidaPT" method="UpdateUserData" value="Modify" cssClass="escondido" cssStyle="position:relative; left:-50% ; top:-50%" />
            </s:form>
            <button type="button" id="btnCerrar" class="megaBoton loginBoton" onclick="modify();">Modify</button>
        </div>
    </body>
</html>

